import config from "@/config"
import http from "@/utils/request"

export default {
	menu: {
		myMenus: {
			url: `${config.API_URL}/system/menu/my/1.6.1`,
			name: "获取我的菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/system/menu/list`,
			name: "获取菜单",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},
	dic: {
		tree: {
			url: `${config.API_URL}/system/dic/tree`,
			name: "获取字典树",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}/system/dic/list`,
			name: "字典明细",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		get: {
			url: `${config.API_URL}/system/dic/get`,
			name: "获取字典数据",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	role: {
		list: {
			url: `${config.API_URL}/sys/role/page`,
			name: "获取角色分页列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		add:{
			url: `${config.API_URL}/sys/role/create`,
			name: "添加角色",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		update:{
			url: `${config.API_URL}/sys/role/update`,
			name: "更新角色",
			put: async function(params){
				return await http.put(this.url, params);
			}
		},
		delete:{
			url: `${config.API_URL}/sys/role/`,
			name: "删除角色",
			delete: async function(params){
				return await http.delete(this.url + params);
			}
		},
		grantResource:{
			url: `${config.API_URL}/sys/role/grant-resource`,
			name: "角色分配资源",
			post: async function(params){
				return await http.post(this.url, params);
			}
		}
	},
	dept: {
		list: {
			url: `${config.API_URL}/system/dept/list`,
			name: "获取部门列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	user: {
		list: {
			url: `${config.API_URL}/sys/user/page`,
			name: "获取用户列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		info: {
			url: `${config.API_URL}/sys/user/info`,
			name: "获取当前用户信息",
			post: async function(){
				return await http.post(this.url);
			}
		},
		queryUserDetailInfoById: {
			url: `${config.API_URL}/sys/user/`,
			name: "获取用户详情",
			get: async function (params) {
				return await http.get(this.url + params);
			}
		},
		add:{
			url:`${config.API_URL}/sys/user/create`,
			name: "添加用户",
			post: async function (params) {
				return await http.post(this.url , params);
			}
		},
		validateUserName:{
			url: `${config.API_URL}/sys/user/validate-username`,
			name: "校验登录账号",
			get: async function (params) {
				return await http.get(this.url , params);
			}
		},
		update:{
			url: `${config.API_URL}/sys/user/update`,
			name: "校验登录账号",
			put: async function (params) {
				return await http.put(this.url , params);
			}
		},
		queryGrantRolesByUserId:{
			url: `${config.API_URL}/sys/user/query-grant-roles`,
			name: "查询用户待分配角色",
			get: async function (params) {
				return await http.get(this.url , params);
			}
		},
		queryRolesByUserId:{
			url: `${config.API_URL}/sys/user/query-roles`,
			name: "查询用户分配角色",
			get: async function (params) {
				return await http.get(this.url , params);
			}
		},
		cancelRole:{
			url: `${config.API_URL}/sys/user/cancel-role`,
			name: "用户取消权限",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		grantSelectRole:{
			url: `${config.API_URL}/sys/user/grant-select-role`,
			name: "用户分配权限",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		resetPassword:{
			url: `${config.API_URL}/sys/user/reset-password`,
			name: "重置密码",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		changePassword:{
			url: `${config.API_URL}/sys/user/change-password`,
			name: "修改密码",
			post: async function(params){
				return await http.post(this.url, params);
			}
		}
	},
	app: {
		list: {
			url: `${config.API_URL}/system/app/list`,
			name: "应用列表",
			get: async function(){
				return await http.get(this.url);
			}
		}
	},
	log: {
		list: {
			url: `${config.API_URL}/system/log/list`,
			name: "日志列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	table: {
		list: {
			url: `${config.API_URL}/system/table/list`,
			name: "表格列管理列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		info: {
			url: `${config.API_URL}/system/table/info`,
			name: "表格列管理详情",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	tasks: {
		list: {
			url: `${config.API_URL}/system/tasks/list`,
			name: "系统任务管理",
			get: async function(params){
				return await http.get(this.url, params);
			}
		}
	},
	resource: {
		list: {
			url: `${config.API_URL}/system/resource/list`,
			name: "登录用户获取资源菜单和权限列表",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		listForManage: {
			url: `${config.API_URL}/sys/resource/list-for-manage`,
			name: "获取资源菜单(管理模块)",
			get: async function () {
				return await http.get(this.url);
			}
		},
		listForGrant: {
			url: `${config.API_URL}/sys/resource/list-for-grant`,
			name: "获取资源菜单(角色授权模块)",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		add: {
			url: `${config.API_URL}/sys/resource/create`,
			name: "新增资源",
			post: async function (params) {
				return await http.post(this.url, params);
			}
		},
		update: {
			url: `${config.API_URL}/sys/resource/update`,
			name: "修改资源",
			put: async function (params) {
				return await http.put(this.url, params);
			}
		},
		validateResourceKey: {
			name: "校验资源别名唯一性",
			url: `${config.API_URL}/sys/resource/validate-resource-key`,
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		batchDelete: {
			url: `${config.API_URL}/system/resource/batchDelete`,
			name: "批量删除资源",
			post: async function (params) {
				return await http.post(this.url, params);
			}
		},
		listAllResourcesByUserId:{
			url: `${config.API_URL}/sys/resource/list-all-resources/`,
			name: "根据用户编号查询资源权限列表",
			get: async function (params) {
				return await http.get(this.url + params);
			}
		}
	}
}
